<template>
	<!-- 数权 -->
	<view>
		<view class="container-top">
			<view>
				<u-avatar :src="userInfo.portrait" size="60"></u-avatar>
			</view>
			<view>
				<view class="tag-box">
					<text style="color: aliceblue;margin-right: 10px;">{{  userInfo.userName  }}</text>
					<uni-tag :inverted="true" text="已实名" type="warning" size="mini" class="tag" />
				</view>

				<text class="text-ac">数权账号:{{ userInfo.phonenumber }}</text>

			</view>
		</view>

		<view class="container-t">
			<view>
				<text class="num" >{{ balance.dataCoin}}</text>
				<text>余额</text>
			</view>
			<view>
				<text class="num" >{{ balance.dataCoin}}</text>
				<text>虚拟币</text>
			</view>
			<view>
				<button class="button-cz" @click="natorecharge()">充值</button>
			</view>
		</view>

		<!-- 我的交易 -->
		<!-- <view class="container-j">
			<uni-title type="h2" title="我的交易" color="white"  ></uni-title>
			<view class="container-icon">
				<view class="icon-box">
					<uni-icons type="wallet" size="30" color="white"></uni-icons>
					<text>我的卖单</text>

				</view>
				<view class="icon-box">
					<uni-icons type="wallet" size="30" color="white"></uni-icons>
					<text>我的买单</text>
				</view>
				<view class="icon-box">
					<uni-icons type="wallet" size="30" color="white"></uni-icons>
					<text>管理费</text>
				</view>
				<view class="icon-box">
					<uni-icons type="wallet" size="30" color="white"></uni-icons>
					<text>交易记录</text>
				</view>
			</view>
		</view> -->
		
		
	
		
		<view class="container-btottom">
			<view  class="list-item">
			  <text>安全设置</text>
			  <view class="list-item-text">
				 <uni-icons type="right" size="22" color="grey"></uni-icons>
			  </view>
			</view>
			
			<view  class="list-item"@click="navTocart()">
			  <text>银行卡</text>
			  <view class="list-item-text">
				 <uni-icons type="right" size="22" color="grey"></uni-icons>
			  </view>
			</view>
			
			<view  class="list-item"@click="navTopay()">
			  <text>支付方式</text>
			  <view class="list-item-text">
				 <uni-icons type="right" size="22" color="grey"></uni-icons>
			  </view>
			</view>
			<view  class="list-item" @click="navToearnings()">
			  <text>收益统计</text>
			  <view class="list-item-text">
				 <uni-icons type="right" size="22" color="grey"></uni-icons>
			  </view>
			</view>
			
		</view>

	</view>
</template>

<script>
	import {getUserInfo,
	getuserDrinfo} from '@/api/user.js'
	import {getwallet} from '@/api/user.js'
	import {
		mapState
	} from 'vuex';

	export default {
		data() {
			return {
				userInfo:null,
				balance:null,

			}
		},
		onLoad() {
			this.loadData();
		},
		computed: {
			...mapState(['hasLogin', 'userInfo'])
		},
		methods: {
			loadData() {
				getUserInfo().then(res=>{
					if(res.code===200){
						console.log(res);
						this.userInfo=res.user;
					}
				})
				getuserDrinfo().then(res=>{
					if(res.code===200){
						console.log(res);
						
					}
				})
				getwallet().then(res=>{
					if(res.code===200){
						console.log(res);
						this.balance=res.data;
					}
				})
			},
			navToearnings() {
				
				uni.navigateTo({
					url: `/pages/user/earnings`
				})
			},
			natorecharge() {
				uni.navigateTo({
					url: `/pages/user/conversion`
				})
			},
			navTocart(){
				uni.navigateTo({
					url: `/pages/user/cart`
				})
			},
			navTopay(){
				uni.navigateTo({
					url: `/pages/user/pay`
				})
			}
			
		}
	}
</script>

<style lang="scss">
	.container-top {
		display: flex;
		margin: 20upx;

		.tag-box {
			margin: 10upx;

			.tag {
				background-color: rgba(#ffbc13, 0.2);
			}

		}

		.text-ac {
			color: darkgray;
		}
	}

	.container-t {
		display: flex;
		justify-content: space-between;
		color: #fff;
		padding: 0 40upx;
		margin: 30upx 0 ;

		.button-cz {
			background: linear-gradient(to right, #5eba8f, #3ba9b3);
			color: #fff;
			height: 55upx;
			width: 150upx;
			line-height: 55upx;
			border-radius: 25upx;
			font-size: $font-base;

		}
	}

	.container-j {
		background-color: $bg-color;
		margin: 10px;
		border-radius: 10px;
		padding: 0 10px;
	}
	
	.container-icon{
		display: flex;
		justify-content: space-around;
		padding: 20upx 0 40upx 0;
		border-radius: 25upx;
		
		.icon-box{
			display: flex;
			flex-direction: column;
			color: white;
		}
		
	}
	
	
	.container-btottom{
		
		background-color: $bg-color;
		margin-top: 20upx;
		margin: 10px;
		border-radius: 25upx;
		.list-item {
			height: 100rpx;
			    display: flex;
			    align-items: center;
			    justify-content: space-between;
			    padding: 0 10px;
			    color: #fff;
			    font-size: 14px;
		}
	}
	

</style>